#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/msg.h>

#define err() do { perror("client1"); exit(EXIT_FAILURE); } while(0)

struct  mymsg {
        long  mtype;
        char  mtext[1024];
} msg;

int main(int argc, char *argv[])
{
	int msgqid;
	if((msgqid = msgget(7976, 0)) < 0 ) err();
	if(msgrcv(msgqid, &msg, sizeof(msg.mtext), 0, 0) < 0 ) err();
	printf(msg.mtext);
	return 0;
}
